using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using ProjectDan.Shell.Views;
using Microsoft.Practices.ObjectBuilder;

public partial class ShellDefault : Microsoft.Practices.CompositeWeb.Web.UI.Page, IDefaultView
{
    private DefaultViewPresenter _presenter;
    private Resources resources;

    protected void Page_Load(object sender, EventArgs e)
    {
        // Instantiate resources
        if (this.resources == null)
        {
            this.resources = new Resources();
        }

        if (!this.IsPostBack)
        {
            this._presenter.OnViewInitialized();

            addToolTips();
        }
        this._presenter.OnViewLoaded();


    }

    private void addToolTips()
    {
        
        // Panel expander
        BMI_help_header.Text = resources.HelpMessages["BMI"].Header;
        BMI_help_description.Text = resources.HelpMessages["BMI"].Description;
        Waist_help_header.Text = resources.HelpMessages["Waist"].Header;
        Waist_help_description.Text = resources.HelpMessages["Waist"].Description;
        Bloodpressure_help_header.Text = resources.HelpMessages["BloodPressure"].Header;
        Bloodpressure_help_description.Text = resources.HelpMessages["BloodPressure"].Description;

        // Overlay expander
        Response.Write("<input id=\"bmi_head\" value=\"" + resources.HelpMessages["BMI"].Header + "\" type=\"hidden\" />");
        Response.Write("<input id=\"bmi_descr\" value=\"" + resources.HelpMessages["BMI"].Description + "\" type=\"hidden\" />");
        Response.Write("<input id=\"waist_head\" value=\"" + resources.HelpMessages["Waist"].Header + "\" type=\"hidden\" />");
        Response.Write("<input id=\"waist_descr\" value=\"" + resources.HelpMessages["Waist"].Description + "\" type=\"hidden\" />");
        Response.Write("<input id=\"bloodpressure_head\" value=\"" + resources.HelpMessages["BloodPressure"].Header + "\" type=\"hidden\" />");
        Response.Write("<input id=\"bloodpressure_descr\" value=\"" + resources.HelpMessages["BloodPressure"].Description + "\" type=\"hidden\" />");

    }

    private void clickevent(object sender, EventArgs e)
    {
        if (sender is ImageButton)
        {
            ImageButton button = (ImageButton)sender;
            if (button.ID == "BMI_icon")
            {
                BMI_help_panel.Visible = true;
            }
        }
    }

    [CreateNew]
    public DefaultViewPresenter Presenter
    {
        get
		{
			return this._presenter;
		}
        set
        {
            if(value == null)
                throw new ArgumentNullException("value");

            this._presenter = value;
            this._presenter.View = this;
        }
    }
}
